# 定义实现斐波那契数列函数
def f(n):
    if n <= 0:
        return []
    elif n == 1:
        return [0]
    elif n == 2:
        return [0, 1]
    else:
        sequence = f(n-1)
        sequence.append(sequence[-1]+sequence[-2])
        return sequence


n = int(input('请输入n的值:'))
a = f(n)
# 筛选小于等于n的斐波那契数，并进行输出
for i in range(0, n):
    if a[i] <= n:
        print(a[i], end=' ')

